import api from './api';

/**
 * AI对话相关的API服务
 */
export const aiChatService = {
  /**
   * 发送消息给AI
   * @param {string} message - 要发送的消息
   * @returns {Promise} 返回AI的回复
   */
  async sendMessage(message) {
    try {
      const response = await api.post('/ai/chat', {
        message: message
      });
      return response.data;
    } catch (error) {
      console.error('发送AI消息失败:', error);
      throw error;
    }
  },

  /**
   * 检查AI服务健康状态
   * @returns {Promise} 服务状态
   */
  async checkHealth() {
    try {
      const response = await api.get('/ai/health');
      return response.data;
    } catch (error) {
      console.error('检查AI服务状态失败:', error);
      throw error;
    }
  }
};